import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

let defaultPerson = ''
let defaultContact = ''
let defaultBank = ''

try {
  if (localStorage.person) {
    defaultPerson = Number(localStorage.person)
  }
  if (localStorage.contacts) {
    defaultContact = Number(localStorage.contacts)
  }
  if (localStorage.bank) {
    defaultBank = Number(localStorage.bank)
  }
} catch (e) {}
export default new Vuex.Store({
  state: {
    NET_WORK_STATUS: '',
    person: defaultPerson,
    contact: defaultContact,
    bank: defaultBank
  },
  mutations: {
    changeNetWork (state, NET_WORK_STATUS) {
      state.NET_WORK_STATUS = NET_WORK_STATUS
    },
    changePersonState (state, person) {
      state.person = person
    },
    changeContactState (state, contact) {
      state.contact = contact
    },
    changeBankState (state, bank) {
      state.bank = bank
    }
  },
  actions: {

  }
})
